home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacApp Release 10 / MacApp Release 10 - HD Ready / Examples / SimpleContainer / UMyODPartView.cp < prev    next >
Encoding:
Text File  |  1996-04-03  |  3.8 KB  |  150 lines  |  [TEXT/MPS ]

  1. //----------------------------------------------------------------------------------------
  2. // UMyMyODPartView.cp
  3. // Copyright © 1996 by Apple Computer, Inc. All rights reserved.
  4. //----------------------------------------------------------------------------------------
  5.  
  6. #ifndef __UMyODPartView__
  7. #include "UMyODPartView.h"
  8. #endif
  9.  
  10. #ifndef __UODPARTVIEW__
  11. #include "UODPartView.h"
  12. #endif
  13.  
  14. #ifndef __UINSERTPARTCOMMAND__
  15. #include "UInsertPartCommand.h"
  16. #endif
  17.  
  18. #ifndef __UContainerDocument__
  19. #include "UContainerDocument.h"
  20. #endif
  21.  
  22. #ifndef __QUICKDRAW__
  23. #include <Quickdraw.h>
  24. #endif
  25.  
  26. // ANSI
  27.  
  28. #ifndef __LIMITS__
  29. #include <limits.h>
  30. #endif
  31.  
  32. // MacApp
  33.  
  34. #ifndef __UMACAPPGLOBALS__
  35. #include "UMacAppGlobals.h"
  36. #endif
  37.  
  38. #ifndef __UCOREGLOBALS__
  39. #include "UCoreGlobals.h"
  40. #endif
  41.  
  42. #ifndef __UVIEW__
  43. #include "UView.h"
  44. #endif
  45.  
  46.  
  47. //========================================================================================
  48. // CLASS TMyODPartView
  49. //========================================================================================
  50. #undef Inherited
  51. #define Inherited TODPartView
  52.  
  53. #pragma segment ASelCommand
  54. MA_DEFINE_CLASS_M1(TMyODPartView, Inherited);
  55.  
  56. //----------------------------------------------------------------------------------------
  57. // Constructor
  58. //----------------------------------------------------------------------------------------
  59. #pragma segment ARes
  60.  
  61. TMyODPartView::TMyODPartView()
  62. {
  63.  
  64. }
  65.  
  66. //----------------------------------------------------------------------------------------
  67. // Destructor
  68. //----------------------------------------------------------------------------------------
  69. #pragma segment MADestructorRes
  70.  
  71. TMyODPartView::~TMyODPartView()
  72. {
  73.  
  74. }
  75.  
  76. //----------------------------------------------------------------------------------------
  77. // TMyODPartView::IODPartShape
  78. //----------------------------------------------------------------------------------------
  79. #pragma segment ARes
  80.               
  81. void TMyODPartView::IMyODPartView(TDocument* itsDocument,
  82.                                    TView* itsSuperView,
  83.                                     const VPoint& itsLocation,
  84.                                     const VPoint& itsSize,
  85.                                    SizeDeterminer itsHSizeDet,
  86.                                     SizeDeterminer itsVSizeDet,
  87.                                     CAFrameRef frameRef)
  88. {
  89.     this->IODPartView(itsDocument,itsSuperView,itsLocation,
  90.                         itsSize,itsHSizeDet,itsVSizeDet,frameRef);
  91. }
  92.  
  93. //----------------------------------------------------------------------------------------
  94. // TMyODPartView::Draw
  95. //----------------------------------------------------------------------------------------
  96. #pragma segment ARes
  97.  
  98. void TMyODPartView::Draw(const VRect& area)
  99. {
  100.     TODPartView::Draw(area);
  101. }
  102.  
  103. //----------------------------------------------------------------------------------------
  104. // TMyODPartView::AquirePartFromDocument(CADocumentRef sourceDocument)
  105. //----------------------------------------------------------------------------------------
  106. #pragma segment Main
  107.  
  108. void TMyODPartView::AquirePartFromDocument(CADocumentRef sourceDocument)
  109. {
  110.     //get the part
  111.     TODPartView::AquirePartFromDocument(sourceDocument);
  112.  
  113.     CADocumentRef    destDocument = fDocument->GetContainer();
  114.  
  115.     //•••Crappy code is just for the DEMO!!!
  116.     //•••How FAST can I pop this out??? ;->
  117.     
  118.     TContainerDocument* theDocument = MA_DYNAMIC_CAST(TContainerDocument,this->fDocument);
  119.     
  120.     
  121.     if(theDocument)
  122.     {
  123.         if(theDocument->fFrameRadioButton->IsOn())
  124.         {
  125.             this->SizePartToView(); 
  126.                                     
  127.         }
  128.         else if(theDocument->fViewRadioButton->IsOn())
  129.         {
  130.             this->SizeViewToPart();
  131.         }
  132.     }
  133. }
  134.  
  135. //----------------------------------------------------------------------------------------
  136. // InitUMyODPartView: 
  137. //----------------------------------------------------------------------------------------
  138. #pragma segment DlgInit
  139.  
  140. void InitUMyODPartView()
  141. {
  142.     MA_REGISTER_CLASS(TMyODPartView);
  143.  
  144.  
  145. //----------------------------------------------------------------------------------------
  146. // End of UMyODPartView.cp
  147.  
  148. #pragma segment Inline
  149.